import math
import numpy as np


def init_zeros_(p):
    t = np.zeros(p.shape, dtype='float32')
    p.set_value(t)


def init_normal_(p, mean, std):
    t = np.random.normal(mean, std, p.shape).astype('float32')
    p.set_value(t)


def kaiming_uniform_(p):
    c_out, c_in, h, w = p.shape
    fan = c_in * h * w
    bound = math.sqrt(6 / fan)
    param = np.random.uniform(-bound, bound, size=p.shape).astype(np.float32)
    return p.set_value(param)